package site.shihuan.helpdesk.im.manager;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import site.shihuan.helpdesk.im.dao.SvcClerkDao;
import site.shihuan.helpdesk.im.model.po.SvcClerkPO;
import site.shihuan.helpdesk.im.model.vo.ClerkVO;

import java.util.Collection;
import java.util.List;

/**
 * 客服人员
 *
 * @author 周世焕
 * @Date 2021/3/3 15:23
 */
@Component
@Slf4j
public class ClerkManager {

    @Autowired
    private SvcClerkDao clerkDao;

    public void changeOnlineStatus(String clerkId,String status) {
        SvcClerkPO clerkPO = new SvcClerkPO();
        clerkPO.setClerkId(clerkId);
        clerkPO.setOnline(status);
        clerkDao.updateByPrimaryKeySelective(clerkPO);
    }

    /**
     * 批量更改在线状态
     * @param collection
     * @param status
     */
    public void changeOnlineStatusBatch(Collection collection, String status) {
        clerkDao.updateOnlineStatusBatch(collection, status);
    }

    public List<String> findOnlineClerkIds(String tenantId) {
        return clerkDao.selectOnlineClerkIds(tenantId);
    }
}
